'use strict';

/**
 * 个人中心
 * MyCenterController
 * @constructor
 */
App.controller('MyCenterController', function($scope, $http, $ionicModal) {
	console.log('HomeTabCtrl');
	
    $scope.fetchCarsList = function() {
        $http.get('MyCenter/userInfolist.json').success(function(myCenterPageVo){
        	console.log(myCenterPageVo);
            $scope.myCenterPageVo = myCenterPageVo;
        });
    };
    $scope.fetchCarsList();

    $scope.addNewCar = function(newCar) {
        $http.post('cars/addCar/' + newCar).success(function() {
            $scope.fetchCarsList();
        });
        $scope.carName = '';
    };

    $scope.removeCar = function(car) {
        $http.delete('cars/removeCar/' + car).success(function() {
            $scope.fetchCarsList();
        });
    };

    $scope.removeAllCars = function() {
        $http.delete('cars/removeAllCars').success(function() {
            $scope.fetchCarsList();
        });

    };

    
});